#!/usr/bin/env python
# encoding: utf-8
# @author: Lin Han
# @contact: voldemort22@126.com
# @file: 20210610.py
# @time: 2021/6/10 15:42
# @desc:
from background.background_update import update_02
from utils.mongo_tools import retrieve_all_mongo_values, update_mongo_value
from views.configs import HISTORY_PART_COLLECTION

history_parts = retrieve_all_mongo_values({}, collection_name=HISTORY_PART_COLLECTION)

for i in history_parts:
    if not "partType" in i["tag"].keys() or i["tag"]["partType"] == None:
        print(i)
        i["tag"]["partType"] = ""
        update_mongo_value(
            filter_condition={"number": i["number"]},
            new_value={"$set": i},
            collection_name=HISTORY_PART_COLLECTION,
        )

update_02()
